package  
{
	import org.flixel.*;
	import flash.display.*;
	import flash.events.TimerEvent;
	import flash.geom.*;

	/**
	 * ...
	 * @author d7ggj
	 */
	public class LightShockwave extends FlxSprite
	{
		[Embed(source = '../lib/WhiteLightCore_smaller.png')] protected var BallPic:Class;
		
		private var visualRadius:int;
		private var growRate:int = 8;
		private var MAXRADIUS: int;// = 175;
		private var timeCount: Number = 0;
		private const MAXTIME: Number = 50;
		private const MINTIME: Number = 15;
		
		public function LightShockwave(xPos:int, yPos:int, size:Number) 
		{
			super(xPos, yPos, BallPic);
			width = size * 2;
			height = size * 2;
			MAXRADIUS = size;
			if (width == MAXRADIUS)
				timeCount = MAXTIME;
			else
				timeCount = MINTIME;
			//moves = false;
		}
		
		public override function update():void
		{
			super.update();
			
			if(visualRadius < MAXRADIUS)
				visualRadius += growRate;
			else if (visualRadius >= MAXRADIUS && timeCount > 0)
				timeCount--;
			else
				this.kill();
		}
		
		override public function render():void
		{
			var myShape:Shape = new Shape();
			myShape.graphics.beginFill(0x999999, .5);
  			
		//	myShape.graphics.beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, matr, spreadMethod,"rgb",.75);

			myShape.graphics.drawCircle(x + origin.x, y + origin.y, visualRadius);
			myShape.graphics.endFill();
			FlxG.buffer.draw(myShape);
		}
	}

}